package com.markhsiu.MiniMQ.broker.store;

import java.util.ArrayList;
import java.util.List;

public  class MemoryStore<T> implements BaseStore<T>{

	private List<T> data = new ArrayList<>();
	
	@Override
	public void add(T t) {
		data.add(t);
	}

	@SuppressWarnings("unchecked")
	@Override
	public T poll() {
		return data.remove(0);
	}

	@Override
	public int size() {
		return data.size();
	}

	@Override
	public List<T> getAll() {
		return data;
	}

}
